Skip to content

feat: expose plan_seats and plan_filled_seats on github_organization data source#3451

Open
zry98 wants to merge 1 commit into
integrations:mainfrom
zry98:feat/expose-org-plan-seats
Open

feat: expose plan_seats and plan_filled_seats on github_organization data source#3451
zry98 wants to merge 1 commit into
integrations:mainfrom
zry98:feat/expose-org-plan-seats

Conversation

@zry98
Copy link
Copy Markdown

@zry98 zry98 commented May 28, 2026

Resolves #3452


Before the change?

The github_organization data source exposes only a plan (the plan name as a string), available seats (plan.seats) and current filled seats (plan.filled_seats) are not exposed as attributes, although they are available from GitHub API's GET /orgs/{org} endpoint as documented here.

When managing organization membership with this provider, there is no way to detect when the org's seats are full when running terraform plan, but terraform apply will fail with You must purchase at least one more seat to add this user as a member. [{Resource: Field:user Code:no_seat Message:}], requiring an organization/enterprise owner to manually add seats before rerunning the apply.

After the change?

Two new computed integer attributes are added to the github_organization data source:

  • plan_seats: The total number of seats included in the organization's plan. 0 if the plan does not have a seat limit (e.g. free plan)
  • plan_filled_seats: The number of seats currently filled in the organization's plan

Both are populated from the existing Organizations.Get call, no additional API request, and the existing plan string attribute is untouched, so this is non-breaking.

Provider users can now gate membership changes via lifecycle precondition, e.g.:

data "github_organization" "this" {
  name = "my-org"
}

resource "github_membership" "new_member" {
  username = "octocat"
  role     = "member"

  lifecycle {
    precondition {
      condition     = data.github_organization.this.plan_seats == 0 || data.github_organization.this.plan_filled_seats < data.github_organization.this.plan_seats
      error_message = "No seats remaining in the GitHub plan, ask an organization/enterprise owner to add more seats first."
    }
  }
}

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@github-actions
Copy link
Copy Markdown

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@github-actions github-actions Bot added the Type: Feature New feature or request label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Get available seats from github_organization data source

1 participant